import {
  SIGN_IN_SUCCESS,
  RESET_LOGIN_TIPS
} from '../constance/actionType';

import _ from 'lodash';
const initState = {
  userName: '',
  lastModifyDate: ''
};

export default function user(state=initState, action) {
  const { type, data } = action;
  switch( type ) {
    case SIGN_IN_SUCCESS:
      return _.assign({}, initState, data, {
        lastModifyDate: +new Date()
      });
    default:
      return state;
  }
}
